package com.fudan.run.ctx;

import java.util.HashMap;
import java.util.Map;

import com.fudan.cfg.base.TransDef;
import com.fudan.run.trans.TransHandler;

public class TransContext extends EnvContext<TransDef,TransHandler<? extends TransDef>>{

	private Map<String,Class<? extends TransDef>> transCfgMap;
	private Map<String,Class<? extends TransHandler<? extends TransDef>>> transHandlerMap;

	public TransContext() {
		this.transCfgMap = new HashMap<>();
		this.transHandlerMap = new HashMap<>();
	}
	@Override
	public void addParser(String name,Class<? extends TransDef> cfgParserClz) {
		this.transCfgMap.put(name, cfgParserClz);
	}
	@Override
	public void addHandler(String name,Class<? extends TransHandler<? extends TransDef>> handlerClz) {
		this.transHandlerMap.put(name, handlerClz);
	}
	@Override
	public Class<? extends TransDef> getParser(String name) {
		return transCfgMap.get(name);
	}
	@Override
	public Class<? extends TransHandler<? extends TransDef>> getHandler(String name) {
		return transHandlerMap.get(name);
	}
}
